import tornado.ioloop
import tornado.web
from tornado.options import define,options,parse_command_line
# get  post
define('port',default=8080,type=int)

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('Hello,扛把子们666888999')
    def post(self):
        self.write('Hello,postman')
def make_app():
    return tornado.web.Application(handlers=[
        (r'/hello',MainHandler),
    ],autoreload=True,debug=True)

if __name__ == "__main__":
    #解析命令行
    parse_command_line()
    #调用make_app()
    app = make_app()
    #监听端口
    app.listen(options.port)
    tornado.ioloop.IOLoop.current().start()
